<% content_for :sidebar do -%>
  <h2>+ <%= link_to "添加新书", new_book_url %></h2>
  <%= link_to "返回管理面板", :controller => '/admin/general', :action => 'index' %>
<% end -%>

<h1>图书管理</h1>

<table border="0" cellspacing="0" cellpadding="3" class="left ol" width="100%">
  <tr>
    <th>封面</th>
    <th>书名</th>
    <th>作者</th>
    <th>出版社</th>
    <th>操作</th>
  </tr>
  <% @books.each do |book| -%>
    <tr>
      <td><%= image_tag book.book_cover.public_filename(:small) if book.book_cover %></td>
      <td><%= link_to h(book.title), book_url(book.id) %></td>
      <td><%= h book.author %></td>
      <td><%= h book.publisher %></td>
      <td><%= link_to "编辑", edit_book_url(book.id) %> | <%= link_to "删除", book_url(book.id), :method => :delete, :confirm => '确定删除么？' %></td>
    </tr>
  <% end -%>
</table>
<%= will_paginate @books %>